package blog

import (
	"fmt"

	"goskeleton/app/utils/response"

	"github.com/gin-gonic/gin"
)

type Create struct {
	CategoryArticleId *float64 `form:"category_article_id" json:"category_article_id" binding:"required"`
	Title             string   `form:"title" json:"title" binding:"required"`
	Content           string   `form:"content" json:"content" binding:"required"`
	SourceUrl         string   `form:"source_url" json:"source_url"`
}

func (c Create) CheckParams(context *gin.Context) {
	if err := context.ShouldBind(&c); err != nil {
		errs := gin.H{
			"tips": "blog/create 参数不合规",
			"err":  err.Error(),
		}
		response.ErrorParam(context, errs)
		return
	}
	fmt.Println("博客参数校验")
}
